import pytest

# @pytest.mark.skip("跳过当前测试类")
# @pytest.mark.skipif( version >3,reason="大于3就不执行")
# @pytest.mark.run(order=3) 控制执行顺序
# --reruns 2 重试2 次

from selenium import webdriver
# 创建浏览器驱动对象，并完成初始化操作

driver = webdriver.Chrome()
driver.maximize_window()
driver.implicitly_wait(10)
driver.get("http://tpshop-test.itheima.net/")
"""
登录功能-密码错误
"""
# 点击首页的‘登录’链接，进入登录页面
driver.find_element_by_link_text("登录").click()
# 输入用户名
driver.find_element_by_id("username").send_keys("13012345678")
# 输入密码
driver.find_element_by_id("password").send_keys("123456")
# 输入验证码
driver.find_element_by_id("verify_code").send_keys("8888")
# 点击‘登录’按钮
driver.find_element_by_name("sbtbutton").click()
# 获取提示信息
msg = driver.find_element_by_class_name("layui-layer-content").text
print("msg=", msg)
# 关闭驱动对象
driver.quit()
